home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / tests / matimp.dia.ref < prev    next >
Text File  |  1999-09-16  |  859b  |  48 lines

  1.  
  2. //   DAE's
  3.  
  4. Leps=1.e-6;
  5.  
  6. // scilab macros
  7.  
  8. deff('[r]=resid(t,y,s)','...
  9. r(1)=-0.04d0*y(1)+1.d4*y(2)*y(3)-s(1),...
  10. r(2)=.04d0*y(1)-1.d4*y(2)*y(3)-3.d7*y(2)*y(2)-s(2),...
  11. r(3)=y(1)+y(2)+y(3)-1.d0')
  12.  
  13. deff('[p]=aplusp(t,y,p)','...
  14. p(1,1)=p(1,1)+1.d0,...
  15. p(2,2)=p(2,2)+1.d0')
  16.  
  17. deff('[p]=dgbydy(t,y,s)','...
  18. p(1,1)=-0.04d0,...
  19. p(1,2)=1.d4*y(3),...
  20. p(1,3)=1.d4*y(2),...
  21. p(2,1)=.04d0,...
  22. p(2,2)=-1.d4*y(3)-6.d7*y(2),...
  23. p(2,3)=-1.d4*y(2),...
  24. p(3,1)=1.d0,...
  25. p(3,2)=1.d0,...
  26. p(3,3)=1.d0')
  27.  
  28. comp(resid);comp(aplusp);comp(dgbydy);
  29.  
  30. //         calling scilab
  31.  
  32. //
  33.  
  34. yt=impl([1;0;0],[-0.04;.04;0],0,0.4,resid,aplusp,dgbydy);
  35.  
  36. //
  37.  
  38. r1=yt-impl([1;0;0],[-0.04;0.04;0],0,0.4,resid,aplusp);
  39.  
  40. if abs(r1) > 1.e-10 then bugmes();quit;end
  41.  
  42. //   calling fortran
  43.  
  44. r2=yt-impl([1;0;0],[-0.04;0.04;0],0,0.4,'resid','aplusp');
  45.  
  46. if abs(r2) > 1.e-10 then bugmes();quit;end
  47.  
  48.